package org.anyin.gitee.cloud.center.upms.enums;

import lombok.Getter;
import org.anyin.gitee.cloud.lib.core.exceptions.CommonException;

@Getter
public enum UpmsExCodeEnum {

    USER_NOT_FOUND("UPMS0001", "用户未找到"),
    ROLE_NAME_EXIST("UPMS0002", "角色名称已经存在"),
    ROLE_NOT_FOUND("UPMS0003", "角色未找到"),
    USER_HAS_ROLE("UPMS0004", "用户拥有角色，不能删除"),
    ROLE_TITLE_EXIST("UPMS0005", "角色标识已经存在"),
    MENU_CODE_EXIST("UPMS0006", "菜单编码已经存在"),
    MENU_PERMISSION_EXIST("UPMS0007", "菜单权限已经存在"),
    MENU_PARENT_NOT_FOUND("UPMS0008", "上级菜单不存在"),
    MENU_CHILDREN_EXIST("UPMS0009", "子菜单存在"),
    MENU_NOT_FOUND("UPMS0010", "菜单不存在"),
    ;


    private String code;

    private String message;

    UpmsExCodeEnum(String code, String message) {
        this.code = code;
        this.message = message;
    }

    public CommonException getException(){
        return new CommonException(this.code, this.message);
    }
}
